package com.hk.button;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.hk.global.ImageUrl;

public class ButtonDouble extends SuperButton {
	private int x = 700;
	private int y = 200;
	private int w = 130;
	private int h = 40;
	
	public ButtonDouble() {
		BoundsButton(x, y, w, h);
		SetButtonIcon(ImageUrl.B_DOUBLE);
	}
	
	@Override
	protected void ActionButton() {
		button.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (!pg.isEnd() && pg.isPlay() && !pg.isHit()) {
					int temp = pg.getBatting() * 2;
					if (pg.getMoney()-temp>=0) {
						if (pg.isSplit()) {
							pg.setSplitbatting(temp);
							ct.SplitTake();
						} else {
							pg.setBatting(temp);
							ct.UserTake();
						}
						End();
					}
				}
			}
		});
	}
	@Override
	public void HideButton() {
		BoundsButton(x, y, w, h);
	}
	@Override
	public void ShowButton() {
		BoundsButton(0, 0, 0, 0);
	}
	@Override
	public JButton getButton() {
		return button;
	}
}
